//
//  DWDTabBarViewController.m
//  dwdWbOc
//
//  Created by Dengdwd on 15/10/9.
//  Copyright © 2015年 dwd. All rights reserved.
//

#import "DWDTabBarViewController.h"
#import "DWDBaseTableViewController.h"
#import "DWDBaseNavViewController.h"
#import "DWDHomeViewController.h"
#import "DWDMessageViewController.h"
#import "DWDDiscoverViewController.h"
#import "DWDProfileViewController.h"
#import "DWDTabBar.h"
@interface DWDTabBarViewController ()

@end

@implementation DWDTabBarViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    DWDTabBar * tabBar = [[DWDTabBar alloc]init];
    tabBar.plusBlock = ^(){
        NSLog(@"点击了按钮");
    };
    self.tabBar = tabBar;
    [self addChildTableViewController];
}


- (void)addChildTableViewController {
    DWDHomeViewController * hv = [[DWDHomeViewController alloc]init];
    [self addChildTableView:hv imageName:@"tabbar_home" title:@"首页"];
    DWDMessageViewController * mv= [[DWDMessageViewController alloc]init];
    [self addChildTableView:mv imageName:@"tabbar_message_center" title:@"消息"];
    DWDDiscoverViewController * dv = [[DWDDiscoverViewController alloc]init];
    [self addChildTableView:dv imageName:@"tabbar_discover" title:@"发现"];
    DWDProfileViewController * pv = [[DWDProfileViewController alloc]init];
    [self addChildTableView:pv imageName:@"tabbar_profile" title:@"我的"];
}


- (void)addChildTableView:(DWDBaseTableViewController *)bv imageName:(NSString *)imageName title:(NSString *)title {
    bv.title = title;
    bv.tabBarItem.image = [UIImage imageNamed:imageName];
    DWDBaseNavViewController * nav = [[DWDBaseNavViewController alloc]initWithRootViewController:bv];
    [self addChildViewController:nav];
}

@end
